
<%@ page language="java" %>

<%@ page import="java.util.List,
                java.util.ArrayList,
				java.util.HashMap,
                java.util.Iterator,
                com.scalar.chiptrack.utils.StringUtils,
                com.scalar.chiptrack.commons.Address,
                com.scalar.chiptrack.operations.packingslip.forms.PackingSlipForm,
                com.scalar.chiptrack.sales.SalesOrder,
                com.scalar.chiptrack.sales.LineItem,
				com.scalar.chiptrack.sales.SubTotal,
                com.scalar.chiptrack.utils.ConfigManager,
                com.scalar.chiptrack.operations.proformainvoice.forms.ProFormaInvoiceForm,
                com.scalar.chiptrack.operations.proformainvoice.dao.ProFormaInvoiceDAO"%>


<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/proFormaInvoice.do"/>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>

<BODY bgColor='#ffffff' leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js">
</script>
<SCRIPT language="JavaScript">

function loadInvoiceByPO()
{
    document.proFormaInvoiceForm.salesOrderId.value = document.proFormaInvoiceForm.poSalesOrderId.value;
    document.proFormaInvoiceForm.deletedInvoiceSalesOrderId.value = -1;

    if (document.proFormaInvoiceForm.salesOrderId.value != -1)
    {
        document.proFormaInvoiceForm.action = '<%=chipTracContext%>/proFormaInvoice.do?action=loadInvoice';
        document.proFormaInvoiceForm.submit();
    }
}

function setCustomerPO()
{
    document.proFormaInvoiceForm.poSalesOrderId.value = document.proFormaInvoiceForm.salesOrderId.value;
    document.proFormaInvoiceForm.deletedInvoiceSalesOrderId.value = -1;
	document.proFormaInvoiceForm.salesOrderNumber.value = '';
}

function setSalesOrderId()
{
    document.proFormaInvoiceForm.salesOrderId.value = document.proFormaInvoiceForm.poSalesOrderId.value;
    document.proFormaInvoiceForm.deletedInvoiceSalesOrderId.value = -1;
	document.proFormaInvoiceForm.salesOrderNumber.value = '';
}

function resetSalesOrderIdAndPOValues()
{
    document.proFormaInvoiceForm.salesOrderId.value = -1;
    document.proFormaInvoiceForm.poSalesOrderId.value = -1;
}

function loadInvoiceBySalesOrder()
{
    document.proFormaInvoiceForm.poSalesOrderId.value = document.proFormaInvoiceForm.salesOrderId.value;
    document.proFormaInvoiceForm.deletedInvoiceSalesOrderId.value = -1;

    if (document.proFormaInvoiceForm.salesOrderId.value != -1)
    {
        document.proFormaInvoiceForm.action = '<%=chipTracContext%>/proFormaInvoice.do?action=loadInvoice';
        document.proFormaInvoiceForm.submit();
    }
}

function loadInvoiceByEnteredSalesOrderNumber()
{
    document.proFormaInvoiceForm.salesOrderId.value = -1;
    document.proFormaInvoiceForm.poSalesOrderId.value = -1;
    document.proFormaInvoiceForm.deletedInvoiceSalesOrderId.value = -1;

    if (document.proFormaInvoiceForm.salesOrderNumber.value.length != 0)
    {
        document.proFormaInvoiceForm.action = '<%=chipTracContext%>/proFormaInvoice.do?action=loadInvoice&bySalesOrderNumber=true';
        document.proFormaInvoiceForm.submit();
    }
}

function loadInvoiceByDeletedInvoiceSalesOrder()
{
    document.proFormaInvoiceForm.salesOrderId.value = -1;
    document.proFormaInvoiceForm.poSalesOrderId.value = -1;

    if( document.proFormaInvoiceForm.deletedInvoiceSalesOrderId.value != -1 )
    {
        document.proFormaInvoiceForm.action = '<%=chipTracContext%>/proFormaInvoice.do?action=loadInvoiceByDeletedInvoiceSalesOrderId';
        document.proFormaInvoiceForm.submit();
    }
}

//Modified by Sarada on 15th Dec 2003
//function deleteInvoice()
function deleteInvoice(salesOrderId)
{
    //if( document.proFormaInvoiceForm.salesOrderId.value != -1 )
   // {

        document.proFormaInvoiceForm.action = '<%=chipTracContext%>/proFormaInvoice.do?action=deleteInvoice&salesOrderId=' + salesOrderId;
        document.proFormaInvoiceForm.submit();
   // }
}

//Below two functions are added by Sarada on 15th Dec 2003
function confirmInvoice(salesOrderId)
{

        document.proFormaInvoiceForm.action = '<%=chipTracContext%>/proFormaInvoice.do?action=ConfirmToDeleteInvoice&Flag=True&salesOrderId=' + salesOrderId;
        document.proFormaInvoiceForm.submit();

}

function cancelPage(salesOrderId)
{
        document.proFormaInvoiceForm.action.value = "CancelPage";
		document.proFormaInvoiceForm.action = '<%=chipTracContext%>/proFormaInvoice.do?action=CancelPage&salesOrderId=' + salesOrderId;
        document.proFormaInvoiceForm.submit();
}


function showInvoice( salesOrderId )
{

    if( salesOrderId != -1 || document.proFormaInvoiceForm.salesOrderNumber.length !=0)
    {
		// added by Vasanth 08/12/2003--begin
        if (salesOrderId == -1 && document.proFormaInvoiceForm.salesOrderNumber.length !=0)
			salesOrderId=document.proFormaInvoiceForm.soId.value;
		// added by Vasanth 08/12/2003--end

		var invoiceURL = '<%=chipTracContext%>/proFormaInvoice.do?action=showInvoice&salesOrderId=' + salesOrderId;
        newWindow = window.open (invoiceURL,'optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,resizable=yes');
        newWindow.focus();
    }
}

// Balaram, June 24, 2003
function submitPage()
{
	/*
	*	Added by Vasanth Tatta 07/14/2003 .....
	*	Script validation to check whether the user entered or selected any criteria
	*	If none of the options were choosen then script throws an error message
	*/
	if( document.proFormaInvoiceForm.salesOrderNumber.value.length == 0 && document.proFormaInvoiceForm.poSalesOrderId.value == -1 &&
		document.proFormaInvoiceForm.deletedInvoiceSalesOrderId.value == -1){
		document.proFormaInvoiceForm.txtErrMsg.value = 'Please choose or select a criteria to search';
		return;
	}

    if( document.proFormaInvoiceForm.salesOrderNumber.value.length != 0 )   // Load Invoice by Sales Order Number
    {
        document.proFormaInvoiceForm.salesOrderNumber.value = trim(document.proFormaInvoiceForm.salesOrderNumber.value);
        for( i=0; i < document.proFormaInvoiceForm.salesOrderId.length; i++ )
        {
            if( document.proFormaInvoiceForm.salesOrderId.options[i].innerText != -1 )
            {
                if ( document.proFormaInvoiceForm.salesOrderNumber.value == document.proFormaInvoiceForm.salesOrderId.options[i].innerText )
                {
                    loadInvoiceByEnteredSalesOrderNumber();
                    return;
                }
            }
        }

        var salesOrderDatails = document.getElementById("salesOrderDetails");
        if( salesOrderDatails != null ){
		    salesOrderDatails.innerHTML = "";
            document.proFormaInvoiceForm.deletedInvoiceSalesOrderId.value = -1;
            document.proFormaInvoiceForm.poSalesOrderId.value = -1;
            document.proFormaInvoiceForm.salesOrderId.value = -1;
        }
        document.proFormaInvoiceForm.txtErrMsg.value = 'Pro Forma Invoice does not exist for Sales Order Number: ' + document.proFormaInvoiceForm.salesOrderNumber.value;
    }
    else if( document.proFormaInvoiceForm.poSalesOrderId.value != -1 )      // load by Customer PO Number
    {
         loadInvoiceByPO();
    }
    else if( document.proFormaInvoiceForm.salesOrderId.value != -1 )        // load by Sales Order ID
    {
        loadInvoiceBySalesOrder();
    }
    else if( document.proFormaInvoiceForm.deletedInvoiceSalesOrderId.value != -1 )  // load by deleted Invoice Sales Order ID
    {
        loadInvoiceByDeletedInvoiceSalesOrder();
    }
}

//Added by Sarada on 13th Nov 2003 to save Bank information
  function savePage()
  {

		document.proFormaInvoiceForm.action = '<%=chipTracContext%>/proFormaInvoice.do?action=saveBankInfo';
		//alert(document.proFormaInvoiceForm.action);
        document.proFormaInvoiceForm.submit();

  }

function cancelAndGoBack()
{
    document.proFormaInvoiceForm.action = '<%=chipTracContext%>/proFormaInvoice.do';
    document.proFormaInvoiceForm.submit();
}
</SCRIPT>


<!-- Top Header Start-->
<%@include file="/jsp/includes/header.jsp"  %>
<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
	<td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<!-- Side Navigation start -->
<%@include file="/jsp/finance/finance_menu.jsp" %>
<!-- end of the side navigations -->

<%
	String id = (String)request.getAttribute("salesOrderId");
%>



<TD bgcolor="#ffffff">
<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
<TD valign="top" width="100%">

<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<BR>


<!-- body starts -->

<center><span class="NArialW">Pro Forma Invoice</span></center>

<html:form name="proFormaInvoiceForm" type="com.scalar.chiptrack.operations.proformainvoice.forms.ProFormaInvoiceForm" action="/proFormaInvoice.do">
<!--added by Vasanth 08/12/2003--begin-->
<input type="hidden" name="soId" value = <%=id%>>
<!--added by Vasanth 08/12/2003--end-->

    <table border='0' width='90%' align='center' class='NArialL'>

        <tr><td colspan='5'><chiptrack:info styleClass='NArialL'/></td></tr>
        <tr><td colspan='5'><chiptrack:errors styleClass='NArialL'/></td></tr>
        <tr><td colspan='5' bgcolor='#FFFFFF'><INPUT align=left border=0 maxLength=100 name="txtErrMsg" size=100
            style="BACKGROUND-COLOR:#FFFFFF; BORDER-BOTTOM: thin; BORDER-LEFT-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-TOP: thin; CLEAR: none; COLOR: red;font-family: verdana;font-size: 8pt;font-weight:bold " value="" readOnly/>
       </td></tr>
	    <tr><td colspan =5 align="left" class='NArialL'><font styleClass="NArialL" id="message" color="FF0000"  />&nbsp;</font></td></tr>
		<tr><td>&nbsp;</td></tr>
        <% if( ! "Yes".equalsIgnoreCase((String)request.getAttribute("setConfirm")) == true){%>
        <tr>
            <td width='15%' align='left' nowrap>Sales Order#:</td>
            <td width='30%'>
                <html:select name="proFormaInvoiceForm" property="salesOrderId" onchange="setCustomerPO()" styleClass="txfield">
                <html:option value="-1">-- Select Sales Order ---</html:option>
                <html:options collection="salesOrderList" property="value" labelProperty="label" styleClass='txfield'/>
                </html:select>
            </td>



            <td width='10%'>&nbsp;</td>
            <td width='15%' align='left' nowrap>Customer Po#:</td>
            <td width='30%' >
                <html:select name="proFormaInvoiceForm" property="poSalesOrderId" onchange="setSalesOrderId()" styleClass="txfield">
                <html:option value="-1">-- Select Customer PO --</html:option>
                <html:options collection="salesOrdercustomerPOList" property="value" labelProperty="label" styleClass='txfield'/>
                </html:select>
            </td>
        </tr>
        <tr><td colspan='5'><img height=10 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></td></tr>

        <tr>
            <td width='15%' align='left' nowrap>Sales Order#:</td>
            <td width='30%'><html:text name='proFormaInvoiceForm' property='salesOrderNumber' styleClass='txfield'/></td>

            <td width='10%'>&nbsp;</td>
            <td width='15%' align='left' nowrap>Deleted Invoices:</td>
            <td width='30%'>
                <html:select name="proFormaInvoiceForm" property="deletedInvoiceSalesOrderId" onchange="resetSalesOrderIdAndPOValues()" styleClass="txfield">
                <html:option value="-1">-- Select Sales Order ---</html:option>
                <html:options collection="invoiceDeletedSalesOrderList" property="value" labelProperty="label" styleClass='txfield'/>
                </html:select>
            </td>
        </tr>

        <tr><td colspan='5'><img height=10 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></td></tr>

        <tr><td colspan=5 align='center'>
        <chiptrack:restrictedLink functionality='<%=Functionality.PRO_FORMA_INVOICE%>' action='<%=User.USER_ACTION_VIEW%>' href='javascript:submitPage();' onmouseover="window.status='Click to Search for Proforma Invoice';return true" onmouseout="window.status='';return true">
        <img border="0" src="<%=chipTracContext%>/jsp/includes/images/submit.gif" title="Click here to Search for Proforma Invoice"></chiptrack:restrictedLink>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <%-- Added by varma 14 jul 2004--%>
	    <%-- <a href="javascript:cancelAndGoBack();" onMouseOver="window.status='Click here to go back to Commercial Invocie Menu';return true" onMouseOut="window.status='';return true"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/cancel.gif"></a> --%>
        <a href="javascript:document.proFormaInvoiceForm.reset();"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" onMouseOver="window.status='Click to Reset';return true" onmouseout="window.status='';return true" title="Click here to Reset"></a>
        </td></tr>
        <%}%>

    </table>


<%
    SalesOrder salesOrder = (SalesOrder) request.getAttribute ("salesOrder");

    if (salesOrder != null)
    {

        Address billingAddress = salesOrder.getBillingAddressAsObject();

        Address shippingAddress = salesOrder.getShippingAddressAsObject();
		//String result = (String)request.getAttribute("DELETE");
		//System.out.println("  delete salesorderNo "+salesOrder.getSalesOrderId());

		//System.out.println("  billingAddress.getContactPerson():  "+billingAddress.getContactPerson());
		//System.out.println("  salesOrder.getContactPerson()   "+salesOrder.getContactPerson());
    %>

    <!-- - - - - - - - - - - - - - - - - - - - - - - - SHOW INVOICE - - - - - - - - - - - - - - - - - START -->
    <font id="salesOrderDetails">
    <table width="90%" cellspacing='0' cellpadding='0' border=0 align=center class='NArialL'>

        <tr><td colspan=5 align=center valign=center>
		   <!--IF condition added by  Sarada to hide Save and Reset but when we select Deleted Sales Order -->
            <% if( ! "Yes".equalsIgnoreCase((String)request.getAttribute("setConfirm")) == true){%>
            <% if( (request.getAttribute( "DELETED_INVOICE" ) == null ) && (
			(String)request.getAttribute("DELETE")== null) ){%>
            <img src='<%=chipTracContext%>/jsp/includes/images/cross.jpg' height='15' width='15' align=center border='0'>
			<!-- <a href='javascript:deleteInvoice()'>[Delete This Invoice]<a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -->
			<!-- Modified by Sarada to display some confirmation before Delete Invoice-->
            <a href='javascript:confirmInvoice(<%=salesOrder.getSalesOrderId() %>)' onmouseover="window.status='Click to Delete this Invoice ';return true" onMouseOut="window.status='';return true">[Delete This Invoice]<a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <!--a href='javascript:showInvoice(document.proFormaInvoiceForm.salesOrderId.value)'-->
            <a href='javascript:showInvoice( <%=salesOrder.getSalesOrderId() %>)' onmouseover="window.status='Click for Printer-Friendly Format';return true" onMouseOut="window.status='';return true">[Printer-Friendly Format]</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <%}else {%>
            <!--a href='javascript:showInvoice(document.proFormaInvoiceForm.deletedInvoiceSalesOrderId.value)'-->
            <a href='javascript:showInvoice(<%=salesOrder.getSalesOrderId() %>)' onmouseover="window.status='Click for Printer-Friendly Format';return true" onMouseOut="window.status='';return true" >
            [Printer-Friendly Format]</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <%}}%>

        </td></tr>

       <tr><td colspan=5><img height=10 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></td></tr>

       <tr height=30>
            <td width="34%" class="NArialL" bgcolor="#DEE1E2" >Bill To:</td>
            <td width='1%'><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"></td>
            <td widht="30%" class="NArialL">&nbsp;</td>
            <td width='1%'><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"></td>
            <td width="34%"  bgcolor="#DEE1E2">Ship To:</td>
       </tr>
       <tr>
            <td bgcolor='#FFFFEE' valign=top>
                <table width="100%" class="NArialL">
					<%-- Condition Added by Krishna Prasad on 6th May 2004 , to not show Customer and Contact Person but to show only Contact Person if both are equal  --%>
					<% if(!(salesOrder.getCustomerName().equals(billingAddress.getContactPerson()))) { %>
                        <tr><td>
						<%=((salesOrder.getCustomerName()==null || salesOrder.getCustomerName().trim().length()==0) ? "" : salesOrder.getCustomerName())%>
                        </td></tr>
					<% } %>
                    <%-- Prabhanjan (14 May 2004) === Removed all the unnecessary code and added this. --%>
                    <tr><td><%=salesOrder.getBillingAddressAsHTML()%></td></tr>
			</table>
            </td>
            <td width='1%'><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"></td>
            <td class="NArialL">
                &nbsp;
            </td>
            <td width='1%'><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"></td>
            <td bgcolor='#FFFFEE' class="NArialL" valign=top>
                <table width="100%" class="NArialL">
                    <tr><td>
                    <% if ( salesOrder.getOdm() != null && salesOrder.getOdm().length() > 0 ) { %>
                        <%=salesOrder.getOdm()%>
                    <% } else {%>
                        <%=((salesOrder.getCustomerName()==null || salesOrder.getCustomerName().trim().length()==0) ? "" : salesOrder.getCustomerName())%>
                    <% }%>
                    </td></tr>
                    <%-- Prabhanjan (14 May 2004) === Removed all the unnecessary code and added this. --%>
                    <tr><td><%=salesOrder.getShippingAddressAsHTML()%></td></tr>
                </table>
            </td>
       </tr>
       <tr><td colspan=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tR>
       <tr>
            <td class="NArialL">
                <table width="100%" class="NArialL">
                    <tr height=30><td bgcolor='#DEE1E2'> Customer PO#</td><td bgcolor='#DEE1E2'>Sales Order#</td></tr>
                    <tr height=30><td bgcolor='#FFFFEE'><%=((salesOrder.getCustomerPO() == null) ? "" : salesOrder.getCustomerPO())%></td><td bgcolor='#FFFFEE'><%=salesOrder.getSalesOrderNo()%></td></tr>
                </table>
            </td>
            <td width='1%'><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"></td>
            <td class="NArialL">
                <table width="100%" class="NArialL">
                    <tr height=30><td bgcolor='#DEE1E2'> Order Date</td><td bgcolor='#DEE1E2'>Ship Via</td></tr>
                    <tr height=30><td bgcolor='#FFFFEE'><%=((salesOrder.getBookingdateAsString() == null) ? "" : salesOrder.getBookingdateAsString())%></td><td bgcolor='#FFFFEE'><%=((salesOrder.getShippingMethod() == null) ? "" : salesOrder.getShippingMethod())%></td></tr>
                </table>
            </td>
            <td width='1%'><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"></td>
            <td class="NArialL">

                <table width="100%" class="NArialL">

                    <tr height=30>
                        <td bgcolor='#DEE1E2'>Sales Person</td>
                        <td bgcolor='#DEE1E2'>Regional Rep</td>
                        <td bgcolor='#DEE1E2'>Del Terms</td>
                        <td bgcolor='#DEE1E2'>Pay Terms</td>
                    </tr>

                    <tr height=30>
                        <td bgcolor='#FFFFEE'>
                            <%=( ( salesOrder.getSalesPerson() == null ) || ( salesOrder.getSalesPerson().trim().length() == 0 ) ) ? "&nbsp;" : salesOrder.getSalesPerson()%>
                        </td>

                        <td bgcolor='#FFFFEE'>
                            <%=( ( salesOrder.getRegionalRep() == null ) || ( salesOrder.getRegionalRep().trim().length() == 0 ) ) ? "&nbsp;" : salesOrder.getRegionalRep()%>
                        </td>

                        <td bgcolor='#FFFFEE'>
                            <%=( ( salesOrder.getDeliveryTerms() == null ) || ( salesOrder.getDeliveryTerms().trim().length() == 0 ) ) ? "&nbsp;" : salesOrder.getDeliveryTerms()%>
                        </td>

                        <td bgcolor='#FFFFEE'>
                            <%=( ( salesOrder.getShippingTerms() == null ) || ( salesOrder.getShippingTerms().trim().length() == 0 ) ) ? "&nbsp;" : salesOrder.getShippingTerms()%>
                        </td>
                    </tr>

                </table>

            </td>
       </tr>

       <tr><td colspan=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tR>
       <tr><td colspan='5'>
        <table width="100%" border=0>
            <tr height=30>
                <td class="NArialL" bgcolor='#DEE1E2' align=center>PO Line#</td>
                <td class="NArialL" bgcolor='#DEE1E2' align=center>Ship Qty</td>
                <td class="NArialL" bgcolor='#DEE1E2' align=center>UM</td>
                <td class="NArialL" bgcolor='#DEE1E2' align=center>
				<bean:message key = "label.mfgPartNumber" /></td>
			    <td class="NArialL" bgcolor='#DEE1E2' align=center>
				<bean:message key = "label.customerPartNumber" /></td>
                <td class="NArialL" bgcolor='#DEE1E2' align=center nowrap>Product Description</td>
                <td class="NArialL" bgcolor='#DEE1E2' align=center>Requested <br>Dock Date</td>
                <td class="NArialL" bgcolor='#DEE1E2' align=center>Scheduled<br>Ship Date</td>

                <!-- Begin : Added by Basha (10/10/2003) -->
                <td class="NArialL" bgcolor='#DEE1E2' align=center>Revised<br>Ship Date</td>
                <!-- End : Added by Basha (10/10/2003) -->

                <td class="NArialL" bgcolor='#DEE1E2' align=center>Taxable</td>
                <td class="NArialL" bgcolor='#DEE1E2' align=center>Unit <br>Price</td>
                <td class="NArialL" bgcolor='#DEE1E2' align=center>Extended<br> Price</td>
            </tr>


            <%
                ArrayList lineItemList = (ArrayList) request.getAttribute ("lineItemsWithSubtotals");

                if ((lineItemList != null) && (lineItemList.size() != 0)) {
                    int lineItemListSize = lineItemList.size();
                    LineItem lineItem = null;
					ArrayList itemList = null;
					HashMap hashMapList = null;
					SubTotal subtotal =  null;

				/*
				* Vasanth 08/19/2003
				* for loop was descending previously. changed to ascending
				* lineItem.getLineItemNo() changed to lineItem.getPoLineItemNo()
				*/

                    for( int i = 0; i <lineItemListSize; i++ )
                    {
                       // lineItem = ( LineItem ) lineItemList.get( i );
					   //Modified by Sarada on 6th April to get sub totals of qty and amt
                        hashMapList = ( HashMap ) lineItemList.get( i );
						if( hashMapList != null )
						{
							java.util.Iterator hashMapListIterator = hashMapList.keySet().iterator();
							while( hashMapListIterator.hasNext() )
							{
							    itemList = (ArrayList)hashMapListIterator.next();
								int itemListSize = itemList.size();
								for( int j = 0;j < itemListSize; j++)
								{
									lineItem = ( LineItem )itemList.get(j);
									subtotal = (SubTotal)hashMapList.get(itemList);

					 %>
                    <tr height=30>
                        <td bgcolor='#FFFFEE' class="NArialL" align=center nowrap>
						<%if(lineItem.getPoLineItemNo()!=0){%>
							<%=lineItem.getPoLineItemNo()%>
						<%}%>
						</td>

                        <td bgcolor='#FFFFEE' class="NArialL" align=center nowrap>
                            <%=( ( lineItem.getQtyAsString() == null ) || ( lineItem.getQtyAsString().trim().length() == 0 ) ) ? "&nbsp;" : lineItem.getQtyAsString()%>
                        </td>

                        <td bgcolor='#FFFFEE' class="NArialL" align=center nowrap>ea</td>

                        <td bgcolor='#FFFFEE' class="NArialL" align=center nowrap>
                            <%=( ( lineItem.getManufacturingPartNo() == null ) || ( lineItem.getManufacturingPartNo().trim().length() == 0 ) ) ? "&nbsp;" : lineItem.getManufacturingPartNo()%>
                        </td>
						<td bgcolor='#FFFFEE' class="NArialL" align=center nowrap>
                            <%=( ( lineItem.getCustomerPartNo() == null ) || ( lineItem.getCustomerPartNo().trim().length() == 0 ) ) ? "&nbsp;" : lineItem.getCustomerPartNo()%>
                        </td>


                        <td bgcolor='#FFFFEE' class="NArialL" align=center width=240>
                            <%=( ( lineItem.getDescription() == null ) || ( lineItem.getDescription().trim().length() == 0 ) ) ? "&nbsp;" : lineItem.getDescription()%>
                        </td>

                        <td bgcolor='#FFFFEE' class="NArialL" align=center nowrap>
                            <%=( ( lineItem.getRequestDate() == null ) || ( lineItem.getRequestDate().trim().length() == 0 ) ) ? "&nbsp;" : lineItem.getRequestDate()%>
                        </td>

                        <td bgcolor='#FFFFEE' class="NArialL" align=center nowrap>
                            <%=( ( lineItem.getScheduleDate() == null ) || ( lineItem.getScheduleDate().trim().length() == 0 ) ) ? "&nbsp;" : lineItem.getScheduleDate()%>
                        </td>

                        <!-- Begin : Added by Basha (10/10/2003) -->
                        <td bgcolor='#FFFFEE' class="NArialL" align=center nowrap>
                            <%=( ( lineItem.getRevisedDate() == null ) || ( lineItem.getRevisedDate().trim().length() == 0 ) ) ? "&nbsp;" : lineItem.getRevisedDate()%>
                        </td>
                        <!-- End : Added by Basha (10/10/2003) -->

                        <td bgcolor='#FFFFEE' class="NArialL" align=center nowrap>
                            <%=( ( lineItem.getIsTaxableAsString() == null ) || ( lineItem.getIsTaxableAsString().trim().length() == 0 ) ) ? "&nbsp;" : lineItem.getIsTaxableAsString()%>
                        </td>

                        <td bgcolor='#FFFFEE' class="NArialL" align=right  nowrap>
                            <%=( ( lineItem.getUnitPriceAsString() == null ) || ( lineItem.getUnitPriceAsString().trim().length() == 0 ) ) ? "&nbsp;" : lineItem.getUnitPriceAsString()%>
                        </td>

                        <td bgcolor='#FFFFEE' class="NArialL" align=right  nowrap>
                            <%=( ( lineItem.getAmountAsString() == null ) || ( lineItem.getAmountAsString().trim().length() == 0 ) ) ? "&nbsp;" : lineItem.getAmountAsString()%>
                        </td>

                    </tr>
				   <%
						}// for
				   %>
						<tr height=30>
						<td  colspan="1" class="NArialL" align=center nowrap>
						Sub Total
						</td>
						<td colspan="1" bgcolor='#FFFFEE' class="NArialL" align=center nowrap>
						<%=( ( subtotal.getSubTotalQty() == null ) || ( subtotal.getSubTotalQty().trim().length() == 0 ) ) ? "&nbsp;" : subtotal.getSubTotalQty()%>
						</td>
                        <td  colspan="9" class="NArialL" align=right  nowrap></td>
                        <td colspan="1" bgcolor='#FFFFEE' class="NArialL" align=right  nowrap>
                        <%=( ( subtotal.getSubTotalAmt() == null ) || ( subtotal.getSubTotalAmt().trim().length() == 0 ) ) ? "&nbsp;" : subtotal.getSubTotalAmt()%>
                        </td>
				</tr>
			   <%
							}//while( hashMapListIterator.hasNext() )
						}// if( hashMapList != null )
                    } // while (lineItems.hasNext()) ...
                } // if ((lineItemList != null) ...
            %>

            <tr><td colspan=10><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tR>
            <tr> <td colspan=11 >
			<!-- Added by  Sarada on 14th Nov 2003 -->
			<h4>Banking Information</h4></td></tr>
            <tr>
			    <td bgcolor='#DEE1E2' width="30%" class="NArialL">BankName</td>
				<td bgcolor='#FFFFEE' colspan=2 >&nbsp;&nbsp;&nbsp;<html:text name='proFormaInvoiceForm' property='bankName' styleClass='txfield' maxlength="50"/></td>
				<td bgcolor='#DEE1E2' colspan=1 class="NArialL" maxlength="50">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Address</td>
				<td bgcolor='#FFFFEE' colspan=1 >&nbsp;&nbsp;&nbsp;<html:text name='proFormaInvoiceForm' property='address' styleClass='txfield' maxlength="50"/></td>
                <td colspan=2>&nbsp;</td>
                <td bgcolor='#DEE1E2' colspan=2 class="NArialL"> Total</td>
                <td bgcolor='#DEE1E2' class="NArialL"  align="right">
                    <%=( ( salesOrder.getSubTotalAsString() == null ) || ( salesOrder.getSubTotalAsString().trim().length() == 0 ) ) ? "&nbsp;" : salesOrder.getSubTotalAsString()%>
                </td>
            </tr>

            <tr>
				<td bgcolor='#DEE1E2' colspan=1 class="NArialL">City</td>
				<td bgcolor='#FFFFEE' colspan=2 >&nbsp;&nbsp;&nbsp;<html:text name='proFormaInvoiceForm' property='city' styleClass='txfield' maxlength="50"/></td>
				<td bgcolor='#DEE1E2' colspan=1 class="NArialL" maxlength="50">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;State</td>
				<td bgcolor='#FFFFEE' colspan=1 >&nbsp;&nbsp;&nbsp;<html:text name='proFormaInvoiceForm' property='state' styleClass='txfield' maxlength="50"/></td>
                <td colspan=2>&nbsp;</td>
                <td bgcolor='#DEE1E2' colspan=2  class="NArialL">Sales Tax</td>
                <td bgcolor='#DEE1E2'  class="NArialL" align="right">
                    <%=( ( salesOrder.getSalesTaxAsString() == null ) || ( salesOrder.getSalesTaxAsString().trim().length() == 0 ) ) ? "&nbsp;" : salesOrder.getSalesTaxAsString()%>
                </td>
            </tr>

            <tr>
				<td bgcolor='#DEE1E2' colspan=1 class="NArialL">ZipCode</td>
				<td bgcolor='#FFFFEE' colspan=2 >&nbsp;&nbsp;&nbsp;<html:text name='proFormaInvoiceForm' property='zipCode' styleClass='txfield' maxlength="50"/></td>
				<td bgcolor='#DEE1E2' colspan=1 class="NArialL"  >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Country</td>
				<td bgcolor='#FFFFEE' colspan=1>&nbsp;&nbsp;&nbsp;<html:text name='proFormaInvoiceForm' property='country' styleClass='txfield'  maxlength="50"/></td>
                <td colspan=2>&nbsp;</td>
                <td bgcolor='#DEE1E2'  colspan=2 class="NArialL">Frieght</td>
                <td bgcolor='#DEE1E2'  class="NArialL" align="right">
                    <%=( ( salesOrder.getFrieghtAsString() == null ) || ( salesOrder.getFrieghtAsString().trim().length() == 0 ) ) ? "&nbsp;" : salesOrder.getFrieghtAsString()%>
                </td>
            </tr>

            <tr>
				<td bgcolor='#DEE1E2' colspan=1 class="NArialL">ABA</td>
				<td bgcolor='#FFFFEE' colspan=2 >&nbsp;&nbsp;&nbsp;<html:text name='proFormaInvoiceForm' property='aba' styleClass='txfield' maxlength="50"/></td>
				<td bgcolor='#DEE1E2' colspan=1 class="NArialL" maxlength="50">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Acct</td>
				<td bgcolor='#FFFFEE' colspan=1 >&nbsp;&nbsp;&nbsp;<html:text name='proFormaInvoiceForm' property='acct' styleClass='txfield' maxlength="50"/></td>
                <td colspan=2>&nbsp;</td>
                <td bgcolor='#DEE1E2'  colspan=2 class="NArialL"><%= salesOrder.getMiscName()%></td>
                <td class="NArialL" bgcolor='#DEE1E2' align="right">
                    <%=( ( salesOrder.getMiscAsString() == null ) || ( salesOrder.getMiscAsString().trim().length() == 0 ) ) ? "&nbsp;" : salesOrder.getMiscAsString()%>
                </td>
            </tr>

            <tr>
				 <td bgcolor='#DEE1E2' colspan=1 class="NArialL">SwiftCode</td>
				<td bgcolor='#FFFFEE' colspan=2 >&nbsp;&nbsp;&nbsp;<html:text name='proFormaInvoiceForm' property='swiftCode' styleClass='txfield' maxlength="50"/></td>
				<td colspan=4>&nbsp;</td>
                <td bgcolor='#DEE1E2'  colspan=2 class="NArialL">Balance Due</td>
                <td  class="NArialL" bgcolor='#DEE1E2' align="right">
                    <%=StringUtils.formatAmount((salesOrder.getSubTotalAsDouble() + salesOrder.getSalesTaxAsDouble() + salesOrder.getFrieghtAsDouble() + salesOrder.getMiscAsDouble()), "$###,###.##")%>
                </td>
            </tr>

			<tr>
			<td colspan=1>&nbsp;</td><td colspan=1>&nbsp;</td>
            <% if( ! "Yes".equalsIgnoreCase((String)request.getAttribute("setConfirm")) == true){%>
			<!--IF condition added by  Sarada to hide Save and Reset but when we select Deleted Sales Order -->
			<% if((request.getAttribute( "DELETED_INVOICE" ) == null) && ((String)request.getAttribute("DELETE") == null) )		{ %>
			<td colspan=1 class="NArialL" align="center"> <br>
			<a href="javascript:savePage();" onMouseOver="window.status='Click to save Banking Information ';return true" onMouseOut="window.status='';return true" title="Click here to Save Banking Information ">
			<img border="0" src="<%=chipTracContext%>/jsp/includes/images/save.gif"></td>

			<td colspan=1 class="NArialL" align="center"> <br>&nbsp;&nbsp;
			<a href="javascript:document.proFormaInvoiceForm.reset();" onMouseOver="window.status='Click to Reset Banking Information ';return true" onMouseOut="window.status='';return true" title="Click here to Reset Banking Information ">
			<img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif"></td>
            <%-- Added by varma 14 jul 2004--%>
            <td colspan=1 class="NArialL" align="center"> <br>
            <a href="javascript:cancelAndGoBack();" onMouseOver="window.status='Click to Cancel';return true" onMouseOut="window.status='';return true" title="Click here to Cancel">
            <img border="0" src="<%=chipTracContext%>/jsp/includes/images/cancel.gif"></a></td>
			<% }} %>
            </tr>


        </table>

       </td>
    </tr>

    <tr><td colspan=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tR>

    </table>
    </font>
    <!-- - - - - - - - - - - - - - - - - - - - - - - - SHOW INVOICE - - - - - - - - - - - - - - - - -  END -->

    <%
        }       // if (salesOrder != null)...
    %>

<!-- Added by  Sarada to show confirm and cancel buttons -->
<% String value = (String)request.getAttribute("setConfirm");
//System.out.println("value     "+value);
if( "Yes".equalsIgnoreCase(value) == true) {
%>
<script language="javascript">
var pa = document.getElementById("message");
var htmltext1  = "<li> Are you sure, you want to delete this Pro-Forma Invoice ? ";
htmltext1 = htmltext1+'<a href="javascript:deleteInvoice(<%=salesOrder.getSalesOrderId()%>);"><img src="<%=chipTracContext%>/jsp/includes/images/confirm.gif" border="0" title="Click here to Confirm the Deletion"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
htmltext1 =htmltext1+'<a href="javascript:cancelPage(<%=salesOrder.getSalesOrderId()%>)"><img src="<%=chipTracContext%>/jsp/includes/images/cancel.gif" border="0" title="Click here to Cancel the Deletion"></a>';
pa.insertAdjacentHTML('BeforeEnd',htmltext1);
</script>
<% } %>
<!--end of additions -->

</html:form>

<!-- till here -->
<BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>

<!-- Footer starts here -->
<%@include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->

</body>
</html>